package recursion_demo;


/**
 * 递归求和 1+2+3+4+...+n
 */
public class recursionSumDemo {



    public  static void main(String[] args) {
        int n=100;
        int sum = recursionSum(n);
        System.out.println(sum);


    }

    public  static int recursionSum(int n){

        if (n==0){
            return 0;
        }else if (n==1){
            return 1;
        }else {
            return n+recursionSum(n-1);
        }
    }



}
